/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package studentwork;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JTextField;

/**
 *
 * @author Administrator
 */
public class Noticepanel extends JPanel{
    JPanel pToday = new JPanel();
    JPanel pTomorrow = new JPanel();
    JList lst = null;
    JTextField txtmag = new JTextField(30);
    JButton btonk = new JButton("提交");
    
    public Noticepanel(){
        GridLayout g = new GridLayout(2,1,100,5);
        this.setLayout(g);
        pToday.setBorder(BorderFactory.createTitledBorder("今日提示"));
        pTomorrow.setBorder(BorderFactory.createTitledBorder("添加明日备忘"));
        pToday.setLayout(new BorderLayout());
        pTomorrow.setLayout(new FlowLayout(FlowLayout.CENTER));
        this.add(pToday);
        this.add(pTomorrow);
        ArrayList l = new Notices().getTodayNotices();
        if (l==null) {
            pToday.add(new JLabel("今天没有什么特别的事情",JLabel.ABORT));
        }else{
            lst = new JList(l.toArray());
            lst.setSize(400,200);
            pToday.add("Center",lst);
        }
        pTomorrow.add(txtmsg);
        pTomorrow.add(btnok);
        
    }
}
